package aop;

import entity.Equip;
import entity.Ring;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class RingAspect {
    @Before("execution(public void updateEquip(entity.Equip))")
    public void ringUp(JoinPoint joinPoint){
        Equip equip = (Equip) joinPoint.getArgs()[0];
        if(equip instanceof Ring ring){
            ring.setName("紫色梦幻"+ring.getName());
            ring.setAttackPlus(ring.getAttackPlus()+6L);
            ring.setDefencePlus(ring.getDefencePlus()+6L);
        }
    }
}
